<template>
  <div class="free-item">
    <div class="pic-wrapper">
      <img :src="item.pic"/>
    </div>
    <div class="info-area">
      <div class="name">{{item.name}}</div>
      <div class="prograss">
        <div class="prograss-bar" >
          <span :style="{'width':item.soldOutPercentage}"></span>
        </div>
        <div class="prograss-persent">已售{{item.soldOutPercentage}}</div>
      </div>
      <div class="oprate-bottom">
        <div class='price'>
          <span class="sign">￥</span>
          <span class="num">{{item.price}}</span>
        </div>
        <div class="btn" :class="{'soldout':item.soldOutPercentage=='100%'}">
          <span v-if="item.soldOutPercentage=='100%'">已售完</span>
          <span v-else>马上抢</span>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  props: {
    item: {
      type: Object,
      default: () => {}
    }
  }
};
</script>
<style lang="scss" scoped>
.free-item {
  width: 344px;
  height: 140px;
  background: #fff;
  border-radius: 10px;
  display: flex;
  padding: 20px 14px;
  margin: 0 auto 12px;
  .pic-wrapper {
    width: 100px;
    height: 100px;
    img {
      width: 100%;
      height: 100%;
    }
  }
  .info-area {
    flex: 1;
    margin-left: 28px;
    .name {
      width: 200px;
      font-size: 14px;
      color: #262626;
      overflow: hidden;
      text-overflow:ellipsis;
      white-space: nowrap;
    }
    .prograss {
      margin-top: 16px;
      display: flex;
      align-content: center;
      align-items: center;
      .prograss-bar {
        width: 110px;
        height: 6px;
        background: #f8f8f8;
        border-radius: 4px;
        position: relative;
        >span{
          position: absolute;
          height: 100%;
          display: inline-block;
          border-radius: 4px;
          background: #FE7528;
        }
      }
      .prograss-persent{
        font-size: 10px;
        color: #7F7F7F;
        letter-spacing: 0;
        line-height: 10px;
        margin-left: 8px;
      }
    }
    .oprate-bottom{
      margin-top: 30px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      .price{ 
        font-size: 18px;
        color: #000000;
        letter-spacing: 0;
        line-height: 18px;
        .sign{
          font-size: 14px;
          margin-right: 2px;
        }
      }
      .btn{
        width: 79px;
        height: 22px;
        background-image: linear-gradient(270deg, #FF7D59 0%, #FE472D 100%);
        box-shadow: 0 0 4px 0 rgba(0,0,0,0.10);
        border-radius: 20px;
        font-size: 12px;
        text-align: center;
        color: #F8F8F8;
        letter-spacing: 0;
        line-height: 22px;
        &.soldout{
          background: #BFBFBF;
        }
      }
    }
  }
}
</style>